package com.hik.springboot_mybatis.mapper;

import com.hik.springboot_mybatis.bean.People;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;

import java.util.List;

/**
 * @author: wukangrong
 * @date: 2020/8/26 20:03
 * @description:
 */
@Mapper
public interface PeopleMapper {

    @Select("select * from people")
    @Results({
            @Result(id = true, column = "pid", property = "pids"),
            @Result(column = "pname", property = "pNames"),
            @Result(column = "pid", property = "cars",
                    many = @Many(select = "com.hik.springboot_mybatis.mapper.CarMapper.find",fetchType = FetchType.LAZY))
    })
    List<People> find();
}
